package com.example.everying.service.content;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.example.everying.model.entity.content.ActivityComment;
import com.example.everying.model.vo.content.ActivityCommentVo;
import com.example.everying.utils.Result;
import jakarta.servlet.http.HttpServletRequest;

import java.util.List;

public interface ActivityCommentService extends IService<ActivityComment> {
    IPage<ActivityComment> selectPage(Page<ActivityComment> pageParam, ActivityCommentVo comment);

    /**
     * 添加评论到数据库
     * @param comment
     */
    void addComment(ActivityComment comment);

    /**
     * 添加评论redis
     * @param comment
     * @return
     */
    ActivityComment saveComment(ActivityComment comment, HttpServletRequest request);


    ActivityComment saveReply(String commentId, ActivityComment reply);
    List<ActivityComment> getCommentsByArticle(String articleId);
    List<ActivityComment> getRepliesByComment(String commentId);

    /**
     * 根据文章id获取评论数据
     * @param articleId
     * @return
     */
    List<ActivityCommentVo> getCommentsByArticleId(String articleId);

    /**
     * 评论删除
     * @param commentId
     */
    void deleteCommentWithRelations(String commentId);

    ActivityComment getLastCommentHaveParent(String userId);

    ActivityComment getLastCommentHaveArticle(String parentId);
}
